<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>安装程序</title>
    <link rel="stylesheet" type="text/css" href="{echo getRequest()}/themes/install/images/install.css?v={echo time()}" media="all"/>
    <script type="text/javascript" src="{echo getRequest()}/content/js/jquery.min.js"></script>
    <script type="text/javascript" src="{echo getRequest()}/content/js/common.js"></script>
    <script type="text/javascript">var weburl = '{echo getRequest()}';</script>
    <script type="text/javascript" src="{echo getRequest()}/content/js/install.js?v={echo time()}"></script>
</head>
<body>

<div id="content">

    <div id="header">
        <h1>小贝篓信息管理系统安装向导</h1>
    </div>

    <div class="step">
        <ul>
            <li class="{echo $this->step == 1 ? 'current' : ( $this->step > 1 ? 'done' : '') }">检查安装环境</li>
            <li class="{echo $this->step == 2 ? 'current' : ( $this->step > 2 ? 'done' : '') }">配置数据库</li>
            <li class="{echo $this->step == 3 ? 'current' : ( $this->step > 3 ? 'done' : '') }">配置管理员</li>
            <li class="{echo $this->step == 4 ? 'current' : ( $this->step > 4 ? 'done' : '') }">安装数据</li>
            <li class="{echo $this->step == 5 ? 'current' : ( $this->step > 5 ? 'done' : '') }">完成</li>
        </ul>
    </div>

    <div class="box">
        <!--{if $this->step === 1 }-->
        <form action="?step={$this->step + 1}" method="post">
            <table cellpadding="0" cellspacing="0" border="0" class="box_table" align="center">

                <tr>
                    <td class="td1" width="40%">PHP运行环境：</td>
                    <td class="td1" width="40%">{echo PHP_VERSION}</td>
                    <td class="td2"><span class="{echo substr(PHP_VERSION, 0, 1) < '5' ? 'failed' : 'success'}"></span></td>
                </tr>

                <!-- 检查目录状态 -->
                <tr>
                    <td class="td1">目录读写权限：</td>
                    <td class="td1">content/date/</td>
                    <td class="td2"><span class="{echo $this->checkDIR( WEBTPL ) ? 'success' : 'failed'}"></span></td>
                </tr>

                <!-- 检查目录状态 -->
                <tr>
                    <td class="td1">目录读写权限：</td>
                    <td class="td1">content/cache/</td>
                    <td class="td2"><span class="{echo $this->checkDIR( WEBCACHE ) ? 'success' : 'failed'}"></span></td>
                </tr>

                <!-- 检查目录状态 -->
                <tr>
                    <td class="td1">目录读写权限：</td>
                    <td class="td1">system/</td>
                    <td class="td2"><span class="{echo $this->checkDIR( WEBLIB ) ? 'success' : 'failed'}"></span></td>
                </tr>

                <!-- 检查Mysql -->
                <tr>
                    <td class="td1">Mysql：</td>
                    <td class="td1">{echo mysql_get_client_info()}</td>
                    <td class="td2"><span class="{echo substr(mysql_get_client_info(), 0, 1) < '5' ? 'failed' : 'success'}"></span></td>
                </tr>

                <!-- 检查GD库 -->
                <tr>
                    <td class="td1">GD库：</td>
                    <td class="td1"><!--{if function_exists('gd_info')}--> {$gd = gd_info()} {$gd['GD Version']}<!--{/if}--></td>
                    <td class="td2"><span class="{echo function_exists('gd_info') ? 'success' : 'failed'}"></span></td>
                </tr>

                <!-- 检查GD库 -->
                <tr>
                    <td class="td1">Zlib：</td>
                    <td class="td1">ZipArchive</td>
                    <td class="td2"><span class="{echo class_exists('ZipArchive') ? 'success' : 'failed'}"></span></td>
                </tr>

                <tr>
                    <td class="td1">&nbsp;</td>
                    <td class="td1"><input type="submit" value="下一步" class="button step{$this->step}" /></td>
                    <td class="td2"></td>
                </tr>
            </table>
        </form>
        <!--{/if}-->
        <!--{if $this->step == 2 }-->
        <form action="?step={$this->step + 1}" method="post">
            <table cellpadding="0" cellspacing="0" border="0" class="box_table" align="center">
                <tr>
                    <td class="td3" width="35%">数据库地址：</td>
                    <td class="td1"><input type="text" class="text required" name="dbhost" value="localhost"  placeholder="请输入数据库地址" /></td>
                </tr>

                <tr>
                    <td class="td3">数据库名：</td>
                    <td class="td1"><input type="text" class="text required" name="dbname" value="stock" placeholder="请输入数据库名" /></td>
                </tr>

                <tr>
                    <td class="td3">数据库用户名：</td>
                    <td class="td1"><input type="text" class="text required" name="dbuser" value="root" placeholder="请输入数据库用户名" /></td>
                </tr>

                <tr>
                    <td class="td3">数据库密码：</td>
                    <td class="td1"><input type="text" class="text required" name="dbpass" value="88888" placeholder="请输入数据库密码" /></td>
                </tr>

                <tr>
                    <td class="td3">数据库表前缀：</td>
                    <td class="td1"><input type="text" class="text required" name="dbprefix" value="sk_" placeholder="请输入数据库表前缀" /></td>
                </tr>

                <tr>
                    <td class="td3">&nbsp;</td>
                    <td class="td1"><input type="button" value="下一步" class="button step{$this->step}" /></td>
                </tr>

            </table>
        </form>
        <!--{/if}-->
        <!--{if $this->step == 3 }-->
        <form action="?step={$this->step + 1}" method="post">
            <!--{loop $_POST $k $v}-->
            <input type="hidden" name="db[{$k}]" value="{echo trim($v)}" />
            <!--{/loop}-->

            <table cellpadding="0" cellspacing="0" border="0" class="box_table" align="center">
                <tr>
                    <td class="td3" width="35%">管理员账号：</td>
                    <td class="td1"><input type="text" class="text required" value="root" name="user[author]" placeholder="请输入管理员账号" /></td>
                </tr>

                <tr>
                    <td class="td3">管理员密码：</td>
                    <td class="td1"><input type="password" class="text required" name="user[pass]" value="888888" placeholder="请输入管理员密码" />
                        (默认:888888)
                    </td>
                </tr>

                <tr>
                    <td class="td3">重复管理员密码：</td>
                    <td class="td1"><input type="password" class="text required" name="user[pass1]" value="888888" placeholder="请重复管理员密码" /></td>
                </tr>

                <tr>
                    <td class="td3">管理员E-Mail：</td>
                    <td class="td1"><input type="text" class="text required" name="user[email]" value="admin@admin.com" placeholder="请输入管理员E-Mail" /></td>
                </tr>

                <tr>
                    <td class="td3">&nbsp;</td>
                    <td class="td1"><input type="button" value="下一步" class="button step{$this->step}" /></td>
                </tr>

            </table>
        </form>
        <!--{/if}-->
        <!--{if $this->step == 4}-->
        <div id="notice"></div>
        <form action="?a=install" method="post">
            <!--{loop $_POST $k $v}-->
            <!--{loop $v $a $b}-->
            <!--{if $a != 'pass1'}-->
            <input type="hidden" name="{$k}[{$a}]" value="{echo trim($b)}" />
            <!--{/if}-->
            <!--{/loop}-->
            <!--{/loop}-->
            <input type="button" href="?step={$this->step + 1}" value="正在安装..." class="button" style="margin-bottom: 10px;" />
        </form>
        <script type="text/javascript">install();</script>
        <!--{/if}-->
        <!--{if $this->step == 5 }-->
        <table cellpadding="0" cellspacing="0" border="0" class="box_table" align="center">
            <tr>
                <td><a href="{echo getRequest()}/">进入小贝篓信息管理系统</a></td>
            </tr>
        </table>
        <!--{/if}-->
    </div>
    <div id="foot">Copyright &copy; 2012 小贝篓信息管理系统 All Rights Reserved.</div>
</div>
</body>
</html>